<template>
  <div>
    <home-header></home-header>
    <home-swiper :swiper='swiper'></home-swiper>
    <home-icons :icon='icon'></home-icons>
    <home-recommend :recommend='recommend'></home-recommend>
    <home-week :week='week'></home-week>
  </div>
</template>
<script>
import HomeHeader from './components/Header'
import HomeSwiper from './components/Swiper'
import HomeIcons from './components/Icons'
import HomeRecommend from './components/Recommend'
import HomeWeek from './components/Week'
import axios from 'axios'
export default {
  name: 'Home',
  components: {
    HomeHeader,
    HomeSwiper,
    HomeIcons,
    HomeRecommend,
    HomeWeek
  },
  data () {
    return {
      swiper: [],
      icon: [],
      recommend: [],
      week: []
    }
  },
  methods: {
    gethomeInfo () {
      axios.get('/api/index.json')
        .then(this.getHomeInfoSucc)
    },
    getHomeInfoSucc (res) {
      res = res.data
      let self = this
      if (res.ret && res.data) {
        const data = res.data
        // self.city = data.city
        self.swiper = data.swiperList
        self.icon = data.iconList
        self.recommend = data.recommendList
        self.week = data.weekendList
      }
    }
  },
  mounted () {
    let self = this
    self.gethomeInfo()
  }
}
</script>
<style>
</style>
